<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.3  (Linux)">
	<META NAME="AUTHOR" CONTENT="rychliks">
	<META NAME="CREATED" CONTENT="20080208;10510000">
	<META NAME="CHANGEDBY" CONTENT="zarych">
	<META NAME="CHANGED" CONTENT="20080226;2200000">
	<STYLE TYPE="text/css">
	<!--
		@page { size: 8.5in 11in; margin: 1in }
		P { margin-bottom: 0.08in; direction: ltr; color: #000000; line-height: 115%; widows: 2; orphans: 2 }
		P.western { font-family: "Calibri", sans-serif; font-size: 11pt; so-language: en-US }
		P.cjk { font-family: "SimSun", "宋体"; font-size: 11pt; so-language: zh-CN }
		P.ctl { font-family: "Calibri", sans-serif; font-size: 11pt; so-language: ar-SA }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" DIR="LTR">
<P ALIGN=CENTER STYLE="margin-bottom: 0in; line-height: 100%"><FONT SIZE=4>Database
Library API</FONT></P>
<P ALIGN=CENTER STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>Relation
Methods:</B></FONT></FONT></P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Constructor:</FONT></FONT></P>
<P STYLE="margin-bottom: 0in; line-height: 100%"> <FONT FACE="Times New Roman, serif"><FONT SIZE=3>Relation(string
relationName, vector&lt;string&gt; attributeData, vector&lt;string&gt;
attributeTypes,                          </FONT></FONT>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%">   <FONT FACE="Times New Roman, serif"><FONT SIZE=3>vector&lt;string&gt;
primaryKeyData)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function creates a relation given a relation name, a list of column
	headers (attributes), the types of those column headers, and allows
	the user to specify one or more primary keys within those headers.</FONT></FONT></P>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
getName()</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Returns
	the name of the relation</FONT></FONT></P>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Vector&lt;string&gt;
getAttributes()</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Returns
	a list of column headers</FONT></FONT></P>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Vector&lt;string&gt;
getRow(int rowIndex)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Returns
	a  list of all of the data in a row when given an index</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Vector&lt;string&gt;
getColumn(string Attribute)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Given
	a column header, this will find what column to return and return all
	data in that column</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
insertData(vector&lt;string&gt; attributeList, vector&lt;string&gt;
values)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function first finds the indexes where the attributes are contained,
	 constructs a list in the proper order, filling in “NULL”s where
	there is no data, then puts the row into the relation. This function
	returns “ok” if everything is ok, or a string error message.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
updateData(string setStatement, string whereConditional) </FONT></FONT>
</P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Parsing
	the setStatement and evaluating it will result in what columns must
	be changed with related data; while parsing the whereConditional
	will result in what rows must be changed. Then the data will be
	updated through access to the table. The function will return “ok”
	if everything worked, or a related error message depending on what
	went wrong.</FONT></FONT></P>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
deleteData(string whereConditional) </FONT></FONT>
</P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Parsing
	the whereConditional will give all rows that need to be removed.
	Then the function will remove those. The function returns “ok”
	if it was successful or a related error message.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String deleteAll()</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function removes all data from the Relation, leaving the name,
	attributes,  and the primary key.</FONT></FONT></P>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>Database Methods:</B></FONT></FONT></P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Constructor:</FONT></FONT></P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Database()</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Creates
	a simple empty database</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Vector&lt;string&gt;
relationNames()</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Returns
	a list of the names of all relations in the database</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Vector&lt;string&gt;
attributeNames(string relation)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Returns
	a list of the attribute names for the given relation</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Int count()</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Returns
	the number of rows in the entire database</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Int count(string
relationName)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Returns
	the number of rows in a given relation</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
 createRelation(string relationName, vector&lt;string&gt;
attributeData, vector&lt;string&gt; attributeTypes,                  
       </FONT></FONT>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
   <FONT FACE="Times New Roman, serif"><FONT SIZE=3>vector&lt;string&gt;
primaryKeyData)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function calls the relation constructor and puts the relation into
	the database. It returns “ok” if everything worked, or a related
	error message.</FONT></FONT></P>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
insertData(string relationName,  vector&lt;string&gt; attributeList,
vector&lt;string&gt;  values)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function chooses the relation and calls its insert function and
	returns “ok” if it worked or a related error message.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
updateData(string relationName, string setStatement, string
whereConditional)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function chooses the relation and calls its update function and
	returns “ok” if it worked or a related error message. –
	Doesn’t Work</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
deleteAll(string relation name)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function chooses the relation and calls its deleteAll function and
	returns “ok” if it worked or a related error message.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
deleteData(string relation name, string whereConditional)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function chooses the relation and calls its deleteData function and
	returns “ok” if it worked or a related error message. –
	Doesn’t Work</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
DeleteRelation(string relationName)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function deletes an entire relation from the database and returns
	“ok” if successful or a related error message.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>string
Query( vector&lt;string&gt; relationNames , vecotr&lt;string&gt;
attributeNames , vector&lt;string&gt; attributeAlias, string where )</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%">  <FONT FACE="Times New Roman, serif"><FONT SIZE=3>Creates
	a new relation(veiw) based on input from the database. Takes a list
	of relations, a list of attributes, a list of possible aliases for
	those attributes and a where conditional as parameters. Returns “ok”
	if succesfull, an error message otherwise. </FONT></FONT>
	</P>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
parseWhere(string where, vector&lt;string&gt; relationNames,
relation1Index, relation2Index)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	in an unparsed where conditional, parses it and populates it with
	values from the specified relation(s), then returns it.   </FONT></FONT>
	</P>
	<UL>
		<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Ex
		input: (table1::attribute1&gt;=table2::attribute2)</FONT></FONT></P>
		<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Ex
		output: (35&gt;=20)</FONT></FONT></P>
	</UL>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>bool
boolEvaluator(string function)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Input
	parameter is a boolean function to be evaluated, output is true or
	false</FONT></FONT></P>
	<UL>
		<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Ex
		input: (35&gt;=20)</FONT></FONT></P>
		<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Ex
		output: true</FONT></FONT></P>
	</UL>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
evalExists(string existsStmt)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	an exists statement in the form “EXISTS relationName” and
	revalues the result. Returns a true statement if true and a false
	statement if false.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
evalSum(string sumStmt, vector&lt;string&gt; relationNames)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	a sum statement in the form “SUM relationName::attrName” and
	evaluates the sum from the data in the relation. Returns a string
	form of the number.</FONT></FONT></P>
</UL>
<P STYLE="margin-bottom: 0in; line-height: 100%"><BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String evalIn(string
inStmt, vector&lt;string&gt; relationNames, int rowIndex)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	an in statement in the form “relationName::attrNameINrelationName”
	and evaluates the result to either a true statement or a false
	statement</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
evalAll(string allStmt, vector&lt;string&gt; relationNames, int
rowIndex)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	an all statement in the form
	“relationName::attrName=ALLotherRelationName” and evaluates
	correctness to either a true statement or a false statement. This
	statement is true if the value at relationName::attrName is equal(or
	any other operator) to any value in a single columned relation.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
evalAny(string anyStmt, vector&lt;string&gt; relationNames, int
rowIndex)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	an Any statement in the form
	“relationName::attrName=AnyotherRelationName” and evalutes
	correctness to either a true statement or a false statement. This
	statement is true if the value at relationName::attrName in the row
	Index is equal (or any other operator) to any value in a single
	columned relation.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
evalCount(string countStmt, vector&lt;string&gt; relationNames)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	a count statement in the form “COUNT relationName::attrName” and
	returns the number of rows in that relation that are not NULL.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
evalMin(string minStmt, vector&lt;string&gt; relationNames)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	a min statement of the form “MIN relationName::attrName” and
	returns the smallest non-NULL value in that column.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
evalMax(string minStmt, vector&lt;string&gt; relationNames) </FONT></FONT>
</P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>Takes
	a max statement of the form “MAX relationName::attrName” and
	returns the largest non-NULL value in that column.</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<BR>
</P>
<P STYLE="margin-left: 0.02in; margin-bottom: 0in; line-height: 100%">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>String
populateSingle(string stmt, vector&lt;string&gt; relationNames, int
relation1RowIndex, int relation2RowIndex)</FONT></FONT></P>
<UL>
	<LI><P STYLE="margin-bottom: 0in; line-height: 100%"><FONT FACE="Times New Roman, serif"><FONT SIZE=3>This
	function populates a statement of the for
	“relationName::attrName=relationName::attrName” with data from
	the graph depending on how many sources there are and what row Index
	is given.</FONT></FONT></P>
</UL>
</BODY>
</HTML>